﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NetDll
{
    class SocketConnectPool
    {
        private Stack<SocketInfo> socketPool;
        public SocketConnectPool(int max)
        {
            socketPool = new Stack<SocketInfo>(max);
        }

        /// <summary>
        /// 取出一个连接对象
        /// </summary>
        public SocketInfo Pop()
        {
            return socketPool.Pop();
        }
        public void Push(SocketInfo info)
        {
            if (info != null)
                socketPool.Push(info);
        }
        public int GetPoolCount()
        {
            return socketPool.Count;
        }
    }
}
